/* Copyright (c) 2016-2020 Enfry Ltd. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Enfry. 
 * You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the agreements
 * you entered into with Enfry.
 */
package com.enfry.storage.api;

import java.util.List;

import org.springframework.dao.DataAccessException;

import com.enfry.storage.api.BaseApi;
import com.enfry.storage.api.IApi;
import com.enfry.storage.entity.Api;
import com.enfry.storage.exception.ExCode;
import com.enfry.storage.exception.StorageException;

public class ApiImpl extends BaseApi implements IApi {

	@Override
    public Api selectByName(String apiName) {
        try {
            Api api = sqlMap.queryForObject("storage.api.selectByName", apiName);
            return api;
        } catch (DataAccessException e) {
            throw new StorageException(ExCode.DB_ERR, e);
        }
    }

    @Override
    public List<Api> selectList() {
        try {
            List<Api> list = sqlMap.queryForList("storage.api.selectList");
            return list;
        } catch (DataAccessException e) {
            throw new StorageException(ExCode.DB_ERR, e);
        }
    }
}
